package com.jy.appmarket.model;

import android.os.Parcel;
import android.os.Parcelable;

import com.jy.app.market.idata.data.Category;

public class CategoryInfo extends Category implements Parcelable {
	private static final long serialVersionUID = -3461308931996635982L;

	public static CategoryInfo fromCategory(Category c) {
		CategoryInfo ci = new CategoryInfo();
		if (c == null) {
			return ci;
		}
		ci.setName(c.getName());
		ci.setUrl(c.getUrl());
		return ci;
	}

	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeString(getName());
		dest.writeString(getUrl());
	}

	public static final Parcelable.Creator<CategoryInfo> CREATOR = new Parcelable.Creator<CategoryInfo>() {
		@Override
		public CategoryInfo createFromParcel(Parcel source) {
			CategoryInfo cat = new CategoryInfo();
			cat.setName(source.readString());
			cat.setUrl(source.readString());
			return cat;
		}

		@Override
		public CategoryInfo[] newArray(int size) {
			return new CategoryInfo[size];
		}
	};
}
